.photo-manager {
  padding: 24px;
  background: var(--bg-color);
  min-height: 100vh;
}

.breadcrumb {
  margin-bottom: 24px;
  padding: 12px 20px;
  font-size: 15px;
  background: var(--photo-but-bg-color);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);

  &-item {
    position: relative;
    color: #5c7cfa;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;

    &:hover {
      color: #4263eb;
      background: rgba(92, 124, 250, 0.08);
    }

    &:first-child {
      &::before {
        content: '🏡';
        margin-right: 6px;
        font-size: 15px;
      }
    }
  }

  &-separator {
    margin: 0 4px;
    color: #94a3b8;
    font-weight: 300;
  }
}

.list {
  border: none;
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  padding: 20px;
  min-height: 400px;

  .grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    grid-auto-flow: row dense; // 确保网格密集排列
  }

  .list-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    height: fit-content;
    width: 100%; // 确保宽度填充

    &.album-item {
      cursor: pointer;

      &:hover {
        background: rgba(52, 152, 219, 0.1);
        transform: translateX(5px);
      }
    }

    .item-image {
      width: 80px;
      height: 80px;
      margin-right: 20px;
      flex-shrink: 0;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;

      &.album-icon {
        width: 80px;
        height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(45deg, #3498db, #2980b9);

        .icon {
          font-size: 36px;
          color: white;
        }
      }

      &:hover {
        transform: scale(1.05);
      }

      :deep(.ant-image) {
        width: 100%;
        height: 100%;

        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          transition: all 0.3s ease;
        }
      }
    }

    .item-content {
      flex-grow: 1;
      min-width: 0; // 防止内容溢出

      h3 {
        margin: 0 0 4px;
        font-size: 16px;
        color: var(--text-color);
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      p {
        margin: 0;
        color: var(--text-color);
        font-size: 13px;
        line-height: 1.4;

        &.size {
          color: var(--text-color);
          font-size: 13px;
          margin-bottom: 4px;
        }

        &.time {
          color: var(--text-color);
          font-size: 12px;
        }
      }
    }

    .item-actions {
      flex-shrink: 0;
      display: flex;
      gap: 6px;

      .btn {
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 12px;
        transition: all 0.3s ease;
        border: none;

        &.small {
          background: #f5f5f5;
          color: #666;

          &:hover {
            background: #e0e0e0;
            transform: translateY(-2px);
          }
        }

        &.danger {
          background: #fff0f0;
          color: #ff4d4f;

          &:hover {
            background: #fff1f0;
            color: #ff1f1f;
            transform: translateY(-2px);
          }
        }

        &.edit {
          background: linear-gradient(45deg, #2c3e50, #3498db);
          color: white;

          &:hover {
            background: linear-gradient(45deg, #3498db, #2c3e50);
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
          }
        }
      }
    }
  }
}

.empty-state {
  grid-column: 1 / -1; // 空状态占据整行
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 40px;

  .empty-content {
    text-align: center;

    .empty-icon {
      font-size: 48px;
      margin-bottom: 16px;
      display: block;
    }

    p {
      color: #999;
      font-size: 14px;
      margin: 0 0 20px;
    }

    .empty-actions {
      display: flex;
      gap: 16px;
      justify-content: center;

      .btn {
        &.primary {
          display: flex;
          align-items: center;
          gap: 8px;
          background: white;
          border: 2px solid #3498db;
          padding: 10px 24px;
          color: #3498db;
          border-radius: 12px;
          font-size: 14px;
          font-weight: 600;
          transition: all 0.3s ease;

          .icon {
            font-size: 20px;
          }

          &:hover {
            transform: translateY(-2px);
            background: #3498db;
            color: white;
            box-shadow: 0 6px 20px rgba(52, 152, 219, 0.2);
          }

          &.upload {
            border-color: #2c3e50;
            color: #2c3e50;

            &:hover {
              background: #2c3e50;
              color: white;
              box-shadow: 0 6px 20px rgba(44, 62, 80, 0.2);
            }
          }
        }
      }
    }
  }
}

// 添加一些自定义样式来适配 Ant Design Vue
:deep(.ant-modal-content) {
  border-radius: 12px;
  overflow: hidden;
}

:deep(.ant-form-item) {
  margin-bottom: 24px;
}

:deep(.ant-input),
:deep(.ant-input-textarea) {
  border-radius: 8px;

  &:hover,
  &:focus {
    border-color: #3498db;
  }
}

:deep(.ant-upload) {
  width: 100%;

  .ant-btn {
    width: 100%;
    border-radius: 8px;
    border: 2px dashed #f0f0f0;
    height: auto;
    padding: 12px;

    &:hover {
      border-color: #3498db;
      color: #3498db;
    }
  }
}

:deep(.ant-upload-list-picture-card) {
  display: flex;
  justify-content: center;
  width: 100%;

  .ant-upload {
    width: 200px;
    height: 200px;
    margin: 0;

    &-text {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      color: #666;

      .icon {
        font-size: 32px;
        margin-bottom: 8px;
      }

      span {
        font-size: 14px;
      }
    }
  }

  .ant-upload-list-item {
    width: 200px;
    height: 200px;
    padding: 0;
    border: none;
    margin: 0;

    &-thumbnail {
      width: 100%;
      height: 100%;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
  }
}

:deep(.ant-upload-list-picture-card-container) {
  width: 200px !important;
  height: 200px !important;
  margin: 0;
}

:deep(.ant-upload-select) {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 200px !important;
  height: 200px !important;
  margin: 0;
  border: 2px dashed #d9d9d9;
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.3s ease;

  &:hover {
    border-color: #3498db;
    background: #f0f7ff;
  }
}

:deep(.ant-upload-wrapper) {
  position: relative;
  width: 200px;

  .ant-upload-list {
    position: relative;
    width: 200px;
    height: 200px;

    .ant-upload-list-item {
      position: relative;
    }
  }

  .ant-upload.ant-upload-select {
    width: 200px !important;
    height: 200px !important;
    margin: 0;

    &:not(.ant-upload-disabled) {
      display: flex !important;
    }
  }

  .ant-upload-list-item-container {
    width: 200px !important;
    height: 200px !important;
    padding: 0;
    margin: 0;
  }
}

:deep(.ant-upload-list-picture-card) {
  .ant-upload-list-item {
    width: 200px;
    height: 200px;
    padding: 0;
    margin: 0;

    &-thumbnail {
      width: 100%;
      height: 100%;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
  }
}

:deep(.ant-upload-select) {
  border: 2px dashed #d9d9d9;
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.3s ease;

  .ant-upload-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;

    .icon {
      font-size: 32px;
      margin-bottom: 8px;
    }

    span {
      font-size: 14px;
    }
  }

  &:hover {
    border-color: #3498db;
    background: #f0f7ff;
  }
}

:deep(.ant-modal-body) {
  .ant-form-item {
    &:last-child {
      margin-bottom: 0;
    }
  }
}

:deep(.ant-upload-wrapper.ant-upload-picture-card-wrapper) {
  .ant-upload-list {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .ant-upload-list-item-container ~ .ant-upload {
    display: none !important;
  }
}

:deep(.photo-preview) {
  .ant-image-preview-img {
    border-radius: 8px;
  }

  .ant-image-preview-operations {
    background: rgba(0, 0, 0, 0.7);
  }
}

.pagination-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding: 0 20px;
}

.list {
  border: none;
  border-radius: 12px;
  background: var(--bg-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  padding: 20px;
  min-height: 400px;
  position: relative;

  &.loading {
    opacity: 0.8;
    filter: blur(1px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .list-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--photo-list-bg-color);
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    height: fit-content;
    opacity: 0;
    transform: translateY(20px);
    animation: itemFadeIn 0.5s ease forwards;

    @for $i from 1 through 10 {
      &:nth-child(#{$i}) {
        animation-delay: #{$i * 0.1}s;
      }
    }

    &.album-item {
      cursor: pointer;

      &:hover {
        background: rgba(52, 152, 219, 0.1);
        transform: translateX(5px);
      }
    }
  }

  .loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--photo-but-bg-color);
    backdrop-filter: blur(8px);
    z-index: 10;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    .loading-spinner {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 20px;
      animation: floatAnimation 2s ease-in-out infinite;

      .icon {
        width: 48px;
        height: 48px;
        border: 3px solid #ffcad4;  // 粉色边框
        border-top-color: #b8c0ff;  // 淡紫色
        border-radius: 50%;
        animation: spin 1s linear infinite;
      }

      span {
        color: #8e9aaf;  // 柔和的灰紫色
        font-size: 15px;
        font-weight: 500;
        letter-spacing: 1px;
        background: linear-gradient(45deg, #ffcad4, #b8c0ff);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      }

      &::after {
        content: '';
        position: absolute;
        width: 120px;
        height: 4px;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 50%;
        filter: blur(4px);
        animation: shadowAnimation 2s ease-in-out infinite;
      }
    }
  }
}

.actions {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .left-actions {
    display: flex;
    gap: 16px;
  }

  .right-actions {
    display: flex;
    gap: 16px;
  }

  .btn {
    &.primary {
      display: flex;
      align-items: center;
      gap: 8px;
      background: var(--photo-but-bg-color);
      border: 2px solid #3498db;
      padding: 10px 24px;
      color: #3498db;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 600;
      transition: all 0.3s ease;
      box-shadow: 0 4px 15px rgba(52, 152, 219, 0.1);

      .icon {
        font-size: 20px;
      }

      &:hover {
        transform: translateY(-2px);
        background: #3498db;
        color: white;
        box-shadow: 0 6px 20px rgba(52, 152, 219, 0.2);
      }

      &.upload {
        border-color: #2c3e50;
        color: var(--text-color);

        &:hover {
          background: #2c3e50;
          color: white;
          box-shadow: 0 6px 20px rgba(44, 62, 80, 0.2);
        }
      }

      &.refresh {
        border-color: #27ae60;
        color: #27ae60;

        &:hover {
          background: #27ae60;
          color: white;
          box-shadow: 0 6px 20px rgba(39, 174, 96, 0.2);
        }

        &.loading {
          opacity: 0.8;
          transform: scale(0.98);
          pointer-events: none;
          transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

          .icon {
            width: 20px;
            height: 20px;
            border: 2px solid currentColor;
            border-top-color: transparent;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            font-size: 0;  // 隐藏原始图标
          }
        }

        &:disabled {
          cursor: not-allowed;
        }
      }
    }
  }
}

@keyframes floatAnimation {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes shadowAnimation {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(0.8);
    opacity: 0.1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes itemFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}